#include<stdio.h>
#include<string.h>

/*#define max 85

char s[max];



int main()
{
	int T = 0;
	scanf("%d", &T);
	while (T--)
	{
		scanf("%s", s);
		int c = 0, h = 0, o = 0, n = 0;
		for (int i = 0; s[i]; i++)
		{
			switch (s[i])
			{

			case 'C':
				if (s[i + 1] - '0' ==  (1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9) )
				{
					c += (s[i + 1]-'0');
					i++;
				}
				else
					c++;
				break;

			case'H':
				if (s[i + 1] - '0' ==( 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9))
				{
					h += (s[i + 1] - '0');
					i++;
				}
				else
					h++;
				break;

			case'O':
				if (s[i + 1]-'0'== (1 || 2 ||   3 || 4 || 5 || 6 || 7 || 8 || 9))
				{
					o += (s[i + 1] - '0'); 
					i++;
				}
				else
					o++;
				break;

			case'N':
				if (s[i + 1] - '0' == (1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9))
				{
					n += (s[i + 1] - '0');
					i++;
				}
				else
					n++;
				break;

			}

		}
		
		double sum=0.0;
		sum = c * 12.01 + h * 1.008 + o * 16.00 + n * 14.01;
		printf("%.3lf\n", sum);
	}


	return 0;
}

int main()
{
	int t=0;
	scanf("%d",&t);
	while(t--)
	{
		int number=0;
		scanf("%d",&number);
		int sum[10]={0};
		for(int i=1;i<=number;i++)
		{
			int k=i;
			
			while(k)
			{
				sum[k%10]++;
				k/=10;
			}
		}
		
		for(int i=0;i<9;i++)
		{
			printf("%d ",sum[i]);
		}
		printf("%d\n",sum[9]);
	}
	return 0;
}*/


char str[105];
int main() 
{
	int n;
	scanf("%d", &n);
	while (n--) 
	{
		scanf("%s", str);
		int len = strlen(str);
		for (int i = 1; i <= len; i++) 
		{
			if (len % i != 0) 
			{
				continue;
			}
			
			int m;
			for (m = i; m < len; m++) 
			{
				if (str[m] != str[m % i]) 
				{
					break;
				}
			}
			if (m == len) 
			{
				printf("%d\n", i);
				break;
			}
		}		
		if (n >= 1) 
		{
			printf("\n");
		}		
	}
	return 0; 
} 

